import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 问卷发起答题记录信息 */
export interface QuestionnaireQuestionRecord {
          id: number; // 答题记录ID
          recordId?: number; // 问卷记录ID
          userId?: number; // 用户ID
          questionId?: number; // 问卷问题ID
          title?: string; // 标题
          tip: string; // 提示语
          type?: boolean; // 题型（0单选 1多选 2填空 3问答 4日期）
          options: string; // 题目选项
          answer: string; // 用户答案
  }

// 问卷发起答题记录 API
export const QuestionnaireQuestionRecordApi = {
  // 查询问卷发起答题记录分页
  getQuestionnaireQuestionRecordPage: async (params: any) => {
    return await request.get({ url: `/business/questionnaire-question-record/page`, params })
  },

  // 查询问卷发起答题记录详情
  getQuestionnaireQuestionRecord: async (id: number) => {
    return await request.get({ url: `/business/questionnaire-question-record/get?id=` + id })
  },

  // 新增问卷发起答题记录
  createQuestionnaireQuestionRecord: async (data: QuestionnaireQuestionRecord) => {
    return await request.post({ url: `/business/questionnaire-question-record/create`, data })
  },

  // 修改问卷发起答题记录
  updateQuestionnaireQuestionRecord: async (data: QuestionnaireQuestionRecord) => {
    return await request.put({ url: `/business/questionnaire-question-record/update`, data })
  },

  // 删除问卷发起答题记录
  deleteQuestionnaireQuestionRecord: async (id: number) => {
    return await request.delete({ url: `/business/questionnaire-question-record/delete?id=` + id })
  },

  /** 批量删除问卷发起答题记录 */
  deleteQuestionnaireQuestionRecordList: async (ids: number[]) => {
    return await request.delete({ url: `/business/questionnaire-question-record/delete-list?ids=${ids.join(',')}` })
  },

  // 导出问卷发起答题记录 Excel
  exportQuestionnaireQuestionRecord: async (params) => {
    return await request.download({ url: `/business/questionnaire-question-record/export-excel`, params })
  },
}